package api

import (
	"api_online/config"
	"api_online/core/parse"
	"api_online/data"
	"api_online/response"
	"net/http"
)

func SyntaxFile(w http.ResponseWriter, r *http.Request) {
	file := r.URL.Query().Get("file")
	file = file + config.Config.GetSuffix()
	path := config.Config.GetPath()

	syntaxFile, SyntaxApiList := parse.Parse(path, file)
	data.Cache.SetSyntaxFile(syntaxFile, SyntaxApiList)

	res, _ := response.SuccessRes(nil)
	w.Write(res)
}